home *** CD-ROM | disk | FTP | other *** search
/ PC/CD Gamer UK 39 / PCGAMER39.bin / games / amber / amberhub.dxr / 00024_GetCDletter() handler, finds CD drive-letter with Lingo...ls < prev    next >
Encoding:
Text File  |  1996-11-08  |  1005 b   |  35 lines

  1. on GetCDletter tagFile, discNumber
  2.   set fileObject to 0
  3.   set fileObject to new(xtra("fileio"))
  4.   if not objectp(fileObject) then
  5.     return #fileioNotCreated
  6.   end if
  7.   repeat with i = 67 to 90
  8.     set drive to numToChar(i)
  9.     set myThisPath to string(drive & ":\hidingPlace\" & tagFile & discNumber)
  10.     openFile(fileObject, myThisPath, 1)
  11.     set statusMsg to #noMessage
  12.     set statusMsg to error(fileObject, status(fileObject))
  13.     if statusMsg = "OK" then
  14.       closefile(fileObject)
  15.       set fileObject to 0
  16.       return drive & ":"
  17.       exit
  18.     end if
  19.   end repeat
  20.   repeat with i = 65 to 66
  21.     set drive to numToChar(i)
  22.     set myThisPath to string(drive & ":\hidingPlace\" & tagFile & discNumber)
  23.     openFile(fileObject, myThisPath, 0)
  24.     set statusMsg to error(fileObject, status(fileObject))
  25.     if statusMsg = "OK" then
  26.       closefile(fileObject)
  27.       set fileObject to 0
  28.       return drive & ":"
  29.       exit
  30.     end if
  31.   end repeat
  32.   set fileObject to 0
  33.   return #driveNotFound
  34. end
  35.